package com.yunxin.download.server.infra.constant.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * @author zero°
 * @since 2023-06-17
 */
@Getter
@RequiredArgsConstructor
public enum DownloadStatusEnum {

    /**
     * 下载状态 0.未下载,1.已下载
     */
    UN_KNOWN(-1, "未知"),

    UN_DOWNLOAD(0, "未下载"),

    DOWNLOADED(1, "已下载"),


    ;

    private final Integer status;
    private final String description;

    public static DownloadStatusEnum getByStatus(int status){
        for (DownloadStatusEnum value : DownloadStatusEnum.values()) {
            if (value.status == status) {
                return value;
            }
        }
        return UN_KNOWN;
    }

}
